package com.mano.mall.gateway.feign;

import com.alibaba.fastjson.JSONObject;
import com.mano.mall.api.dto.gatewayhandler.input.GatewayHandlerInputDTO;
import com.mano.mall.api.dto.gatewayhandler.output.GatewayHandlerOutputDTO;
import com.mano.mall.api.gatewayhandler.GatewayHandlerService;
import com.mano.mall.common.base.BaseApiService;
import com.mano.mall.common.base.BaseResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;

import java.util.List;

@FeignClient(value = "mano-mall-gatewayhandler",fallback = GatewayHandlerServiceFeignCallBack.class)
public interface GatewayHandlerServiceFeign extends GatewayHandlerService {
}

@Component
class GatewayHandlerServiceFeignCallBack extends BaseApiService implements GatewayHandlerServiceFeign{
    @Override
    public BaseResponse<JSONObject> addGWHandler(GatewayHandlerInputDTO gatewayHandlerInputDTO) {
        return setResultError("服务器忙，请稍后重试");
    }

    @Override
    public BaseResponse<JSONObject> deleteGWHandler(Integer id) {
        return setResultError("服务器忙，请稍后重试");
    }

    @Override
    public BaseResponse<JSONObject> openGWHandler(Integer id) {
        return setResultError("服务器忙，请稍后重试");
    }

    @Override
    public BaseResponse<JSONObject> closeGWHandler(Integer id) {
        return setResultError("服务器忙，请稍后重试");
    }

    @Override
    public BaseResponse<JSONObject> upGWHandler(Integer id) {
        return setResultError("服务器忙，请稍后重试");
    }

    @Override
    public BaseResponse<JSONObject> downGWHandler(Integer id) {
        return setResultError("服务器忙，请稍后重试");
    }

    @Override
    public BaseResponse<List<GatewayHandlerOutputDTO>> getGWHandlerList() {
        return setResultError("服务器忙，请稍后重试");
    }
}